package cn.ycc1.account.controller;

import cn.ycc1.account.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title:
 * @Author ycc
 * @Date 2023/7/4 14:34
 */
@RestController
@RequestMapping("/account")
@Api(tags = "账户管理")
public class AccountController {
    @Autowired
    AccountService accountService;

    @ApiOperation(value = "扣除用户余额")
    @PutMapping("/{userId}/{money}")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value="简历状态",name="status",dataType="Stirng",paramType = "query"),
//    })
    public ResponseEntity<Void> deduct(@ApiParam("用户ID") @PathVariable("userId") String userId, @ApiParam("扣除金额") @PathVariable("money") Integer money){
        accountService.deduct(userId, money);
        return ResponseEntity.noContent().build();
    }
}
